import React from 'react';
import { Redirect, Route } from 'react-router-dom'
let isLogin = false
class Protect extends React.Component {
  render() {
    let { path, component: Com, ...res } = this.props
    return <Route path={path} render={props => {
      if (isLogin) {
        return <Com {...props} {...res} />
      } else {
        return <Redirect to='/login'></Redirect>
      }
    }}>

    </Route>;
  }
}
export default Protect